<?php

use console\services\MigrateService;
use yii\db\Migration;

/**
 * Handles the creation of table `sys_app_token`.
 */
class m231229_144104_create_sys_app_token_table extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $this->createTable('sys_app_token', [
            'id' => $this->bigPrimaryKey(),
            'token' => $this->string(64)->defaultValue('')->unique()->notNull()->comment('登录凭证'),
            'type' => $this->string(32)->defaultValue('')->null()->comment('用户类型'),
            'plat' => $this->string(32)->defaultValue('')->null()->comment('平台类型'),
            'user_id' => $this->bigInteger()->defaultValue(0)->null()->comment('用户id'),
            'extend' => $this->string(255)->defaultValue('')->null()->comment('额外信息'),
            'exp_time' => $this->bigInteger()->defaultValue(0)->null()->comment('过期时间'),
        ], MigrateService::createTableOptions('登录token表'));
    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('sys_app_token');
    }
}
